#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QString>
#define  HEXMAXSIZE  0x1FFFFF
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_pushButtonOpenFile_clicked();

    void on_pushButtonTurn_clicked();

    void on_checkBoxEncryp_stateChanged(int arg1);

private:
    Ui::MainWindow *ui;

private:
    QString  HexPath;
    int hexAddress;
    int hexMaxAddress;
private:
    void searchMaxAddress(); //查找最大的地址
    void desEncryptionData(int address,int size,unsigned char *key,unsigned char *data); //加密数据
    void saveBinFile(QString path,unsigned char *data); //保存文件
    void eraseEncryptionDataSeg(int address,int size,unsigned char *data);//擦除加密程序
    void createBinFile(QString path,unsigned char *data); //创建bin文件
    bool checkInputDataLegal();//检验输入是不是合法
    int  hexStringtoHex(QString str);//16进制字符串转16进制数字
};

#endif // MAINWINDOW_H
